﻿// This source is subject to Microsoft Public License (Ms-PL).
// Please see http://taskcardcreator.codeplex.com for details.
// All other rights reserved.

using System.Text.RegularExpressions;

namespace ScrumDetailed.Converters
{
  /// <summary>
  /// Methods to remove HTML from strings.
  /// </summary>
  internal class HtmlRemoval
  {
    /// <summary>
    /// Remove HTML from string with Regex.
    /// </summary>
    public static string StripTagsRegex(string source)
    {
      string sourceString;
      sourceString = Regex.Replace(source, "<P>", "");
      sourceString = Regex.Replace(sourceString, "\n", "");
      sourceString = Regex.Replace(sourceString, "</P>", "\r\n");
      sourceString = Regex.Replace(sourceString, "<BR>", "\r\n");
      sourceString = Regex.Replace(sourceString, "<.*?>", string.Empty);
      sourceString = Regex.Replace(sourceString, "&nbsp;", " ");
      sourceString = Regex.Replace(sourceString, "&lt;", "");
      sourceString = Regex.Replace(sourceString, "&gt;", "");
      return sourceString;
    }
  }
}